<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>context</title>
</head>
<body>
    <div id="app"></div>
</body>
<script src="https://unpkg.com/vue@next"></script>
<script>
    const app = Vue.createApp({
        template: `<div>
            <h1 style="color: red" @click="this.count ++">
                商品（铅笔） 数量：{{count}}， 小计： {{subtotal}} 元，总价： {{total}}
                </h1>
            </div>`,
    })

    app.component('component-demo', {
        setup(props, context) {
            const { ref,computed } =Vue;
            const count = ref(0);
            const subtotal = computed(() => {
                return coun.value * 5.0;
            })

            const total = computed({
                get: () => {
                    return count.value * 5.0 + 100;
                },
                set: (val) => {
                    return count.value =val - 5 ;
                }
            })
            return { count, subtotal,total}
        }
    })

    const vm = app.mount("#app")
</script>
</html>